/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.omazan.db.models;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author stryke
 */
@Entity
@Table(name = "SHIPMENTS", catalog = "OMAZANDB", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Shipments.findAll", query = "SELECT s FROM Shipments s"),
    @NamedQuery(name = "Shipments.findByShipmentId", query = "SELECT s FROM Shipments s WHERE s.shipmentId = :shipmentId")})
public class Shipments implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "shipmentId", nullable = false)
    private Integer shipmentId;
    @JoinColumn(name = "locationId", referencedColumnName = "locationId")
    @ManyToOne(fetch = FetchType.LAZY)
    private Locations locationId;
    @JoinColumn(name = "exceptionId", referencedColumnName = "exceptionId")
    @ManyToOne(fetch = FetchType.LAZY)
    private Exceptions exceptionId;
    @JoinColumn(name = "orderId", referencedColumnName = "orderId")
    @ManyToOne(fetch = FetchType.LAZY)
    private Orders orderId;

    public Shipments() {
    }

    public Shipments(Integer shipmentId) {
        this.shipmentId = shipmentId;
    }

    public Integer getShipmentId() {
        return shipmentId;
    }

    public void setShipmentId(Integer shipmentId) {
        this.shipmentId = shipmentId;
    }

    public Locations getLocationId() {
        return locationId;
    }

    public void setLocationId(Locations locationId) {
        this.locationId = locationId;
    }

    public Exceptions getExceptionId() {
        return exceptionId;
    }

    public void setExceptionId(Exceptions exceptionId) {
        this.exceptionId = exceptionId;
    }

    public Orders getOrderId() {
        return orderId;
    }

    public void setOrderId(Orders orderId) {
        this.orderId = orderId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (shipmentId != null ? shipmentId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Shipments)) {
            return false;
        }
        Shipments other = (Shipments) object;
        if ((this.shipmentId == null && other.shipmentId != null) || (this.shipmentId != null && !this.shipmentId.equals(other.shipmentId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.omazan.entities.Shipments[ shipmentId=" + shipmentId + " ]";
    }
    
}
